package com.example.springbootquartz.service;

import com.alibaba.fastjson.JSONObject;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class QuartzEventServiceImpl{
//    private static final String JOB_GROUP = "event_job_group";
//    private static final String TRIGGER_GROUP = "event_trigger_group";
//
//    @Autowired
//    private Scheduler scheduler;
//
//    public void addQuartz() throws SchedulerException {
//        JSONObject eventData = JSONObject.parseObject(event.getEventData());
//        Date triggerDate = eventData.getDate("date");
//        JobDetail job = JobBuilder.newJob(EventJob.class).withIdentity(event.getId().toString(), JOB_GROUP).usingJobData(buildJobDateMap(event)).build();
//        Trigger trigger = TriggerBuilder.newTrigger().withIdentity(event.getId().toString(), TRIGGER_GROUP).startAt(triggerDate).build();
//        scheduler.scheduleJob(job, trigger);
//    }

}
